﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KursovickCS
{
    [Serializable]
    class Float : IObject
    {

        private static string CLASS_NAME = "Float";

        private float data = 0.0F;

        
        public Float (float obj)
        {
            data = obj;
         
        }

        public int Equals(IObject obj)
        {
            Float strObj = (Float)obj;
            return data.CompareTo(strObj.data);
        }

        public void Sum(IObject obj)
        {
            data += ((Float)obj).data;
        }

        public string Name()
        {
            return CLASS_NAME;

        }

        public int Compare(IObject obj)
        {
            float data = ((Float)obj).data;
            if (this.data < data)
            {
                return -1;
            }
            else if (this.data > data)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }

        public Object UserData()
        {
            return data;
        }
    }
}
